//
//  PersonTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/12.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "PersonTableViewCell.h"

@implementation PersonTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        self.separatorInset = UIEdgeInsetsMake(0, 15, 0, 0);
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.img];
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.detailLabel];
}

-(UIImageView *)img
{
    if (_img == nil) {
        _img = [[UIImageView alloc] initWithFrame:CGRectMake(15, 21, 20, 20)];
        _img.clipsToBounds = YES;
    }
    return _img;
}

-(UILabel *)nameLabel
{
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 15, 150, 30)];
        _nameLabel.font = font(16);
        _nameLabel.textColor = SFMColor(51, 51, 51);
        _nameLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _nameLabel;
}

-(UILabel *)detailLabel
{
    if (_detailLabel == nil) {
        _detailLabel = [[UILabel alloc] init];
        _detailLabel.font = font(10);
        _detailLabel.textColor = SFMColor(254, 101, 54);
        _detailLabel.textAlignment = NSTextAlignmentCenter;
        _detailLabel.backgroundColor = SFMColor(255, 225, 213);
        _detailLabel.layer.cornerRadius = 12.5;
        _detailLabel.clipsToBounds = YES;
    }
    return _detailLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
